import { Body, Controller, Get, Post, Query } from '@nestjs/common';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { BindUserOtherHalfDTO, GetOtherHalfInfoBySysIDDTO, GetUserHoroscopeDTO, GetUserInfoByLoveCodeDTO, GetUserInfoBySysIDDTO, GetUserLimitDTO, GetUserLoveCodeDTO, GetUserOpenIDDTO, HandleUserDTO, RegisterUserDTO, SendRegisterSmsCodeDTO, SubmitFeedBackDTO, UploadAvatarDTO, UserSignInDTO } from './user.dto';
import { UserService } from './user.service';


@Controller({
  path: 'wechat/user',
  version: '1',
})
@ApiTags('用户相关')
export class UserController {
  constructor(private readonly userService: UserService) {}

  @Get('getOtherHalfInfoBySysID')
  @ApiOperation({ summary: '获取另一半的数据' })
  async getOtherHalfInfoBySysID(@Query() param:GetOtherHalfInfoBySysIDDTO) {
    const { UserSysID = -1 }=param
    return await this.userService.getOtherHalfInfoBySysID(UserSysID);
  }

  @Get('getUserOpenID')
  @ApiOperation({ summary: '获取用户的OpenID' })
  async getUserOpenID(@Query() param:GetUserOpenIDDTO){
    return await this.userService.getUserOpenID(param);
  }

  @Post('sendRegisterSmsCode')
  @ApiOperation({ summary: '发送注册短信' })
  async sendRegisterSmsCode(@Body() sendRegisterSmsCode:SendRegisterSmsCodeDTO){
    return await this.userService.sendRegisterSmsCode(sendRegisterSmsCode)
  }

  @Post('registerUser')
  @ApiOperation({ summary: '注册用户' })
  async registerUser(@Body() registerUser:RegisterUserDTO){
    return await this.userService.registerUser(registerUser)
  }

  @Post('uploadAvatar')
  @ApiOperation({ summary: '保存头像' })
  async uploadAvatar(@Body() uploadAvatar:UploadAvatarDTO){
    return await this.userService.uploadAvatar(uploadAvatar)
  }

  @Post('userSignIn')
  @ApiOperation({ summary: '用户签到' })
  async userSignIn(@Body() userSignIn:UserSignInDTO){
    return await this.userService.userSignIn(userSignIn)
  }

  @Get('getUserLimit')
  @ApiOperation({ summary: '获取用户权限' })
  async getUserLimit(@Query() getUserLimit:GetUserLimitDTO){
    return await this.userService.getUserLimit(getUserLimit);
  }

  @Get('getUserHoroscope')
  @ApiOperation({ summary: '获取用户星座运势' })
  async getUserHoroscope(@Query() getUserHoroscope:GetUserHoroscopeDTO){
    return await this.userService.getUserHoroscope(getUserHoroscope);
  }

  @Post('submitUserFeedBack')
  @ApiOperation({ summary: '提交用户反馈' })
  async submitUserFeedBack(@Body() submitFeedBack:SubmitFeedBackDTO){
    return await this.userService.submitFeedBack(submitFeedBack)
  }

  @Get('getUserLoveCode')
  @ApiOperation({ summary: '获取用户恋爱密码' })
  async getUserLoveCode(@Query() getUserLoveCode:GetUserLoveCodeDTO){
    return await this.userService.getUserLoveCode(getUserLoveCode);
  }

  @Get('getUserInfoByLoveCode')
  @ApiOperation({ summary: '根据恋爱密码获取用户信息' })
  async getUserInfoByLoveCode(@Query() getUserInfoByLoveCode:GetUserInfoByLoveCodeDTO){
    return await this.userService.getUserInfoByLoveCode(getUserInfoByLoveCode)
  }

  @Post('bindUserOtherHalf')
  @ApiOperation({ summary: '绑定另一半' })
  async bindUserOtherHalf(@Body() bindUserOtherHalf:BindUserOtherHalfDTO){
    return await this.userService.bindUserOtherHalf(bindUserOtherHalf)
  }

  @Post('handleUser')
  @ApiOperation({ summary: '修改用户' })
  async handleUser(@Body() handleUser:HandleUserDTO){
    return await this.userService.handleUser(handleUser)
  }

  @Get('getUserInfoBySysID')
  @ApiOperation({ summary: '获取用户信息' })
  async getUserInfoBySysID(@Query() getUserInfoBySysID:GetUserInfoBySysIDDTO){
    return await this.userService.getUserInfoBySysID(getUserInfoBySysID)
  }
}
